﻿<script type="text/javascript">
    var ajaxRequestCount = 0;
    function fieldChange(obj) {
    var conditionTypeList = $('#ConditionTypeList').val();
    var selectItem;
    if (conditionTypeList != "")
    {
        conditionTypeList = eval("(" + conditionTypeList + ")");
        if (conditionTypeList.hasOwnProperty(obj.value))
        {
            selectItem = conditionTypeList[obj.value];
        }
    }
    ajaxRequestCount++;
        $.ajax({
            type: "get",
            url: "@Html.Raw(Url.Action("GetFieldMatchTypeList", "SingleSearch"))",
            data: { "dbCode": $('#dbName').val(), "fieldName": obj.value },
            success: function (msg) {
                var select = document.getElementById(getConditionQueryName(obj.name))
                select.innerHTML = "";
                var index = -1;
                var selectIndex = 0;
                for (var p in msg) {//遍历json数组时，这么写p为索引，0,1
                    index++;
                    select.options.add(new Option(p, msg[p]));
                    if (msg[p] == selectItem)
                    {
                        selectIndex = index;
                    }
                }
                select[selectIndex].selected = true;
                ajaxRequestCount--;

                var autoLoad = $("#AutoLoad").val();
                if (autoLoad == "True" && ajaxRequestCount == 0) {
                    search();
                }
            },
            error: function (e)
            { }
        })
    }
    function getConditionQueryName(name) {
        name = name.replace("Key", "Query");
        var fdStart = name.indexOf("Sub");
        if (fdStart != 0) {
            name = "Sub" + name;
        }
        return name;
    }


    function categoryChange() {
        var link = $('#UpdateCatLink');
        var select = $('#categoryType');
        var dbID = $('#dbID').val();
        var dbName = $('#dbName').val();
        link.attr("href", "SingleSearch/GetCategroyList?id=" + dbID + "&type=" + select.val() + "&dbName=" + dbName);
        link.click();
    }
    function searchSingle(id) {
        copyContion();//每次点击检索时将生效的查询条件存起来，避免点击分页或者列表，摘要模式时查询条件混乱
        $('#pageIndexNow').val('1');
        $('#checkedCatID').val(id);
        $("#beforecheckedCatID").val($("#checkedCatID").val());
        var searchForm = $('#searchForm');
        searchForm.submit();
    }

    function search() {
        $('#pageIndexNow').val('1');
        //if (typeof (myTree) != "undefined") {
        //    var checkstr = myTree.getAllChecked();
        //    if ((checkstr == "" || checkstr == "0") && myTree.getAllFatItems() != "") {
        //        messageAlert("请先选择分类！");
        //        return;
        //    }
        //}
        copyContion();//每次点击检索时将生效的查询条件存起来，避免点击分页或者列表，摘要模式时查询条件混乱
        searchResult();
    }
    //点击分页
    function searchPageNew(n) {
        $('#pageIndexNow').val(n);
        searchResult();
    }
    function searchResult() {
        var searchForm = $('#searchForm');
        searchForm.submit();
    }
    function addCondition() {
        var subID = parseInt($('#currentSubid').val()) + 1;
        var len = document.getElementById("ConditionKey").options.length;
        if (subID < len) {
            var subDiv = $('#subCondition0');
            subDiv = subDiv.clone(true);
            subDiv.attr("style", "");
            subDiv.attr("id", "subCondition" + subID);
            var idstr = "SubConditionKey" + subID;
            subDiv.children("#SubConditionType0").attr("name", "SubConditionType" + subID);
            subDiv.children("#SubConditionType0").attr("id", "SubConditionType" + subID);
            subDiv.children("#SubConditionKey0").attr("name", idstr);
            subDiv.children("#SubConditionKey0").attr("id", idstr);

            subDiv.children("#SubConditionValue0").attr("name", "SubConditionValue" + subID);
            subDiv.children("#SubConditionValue0").attr("id", "SubConditionValue" + subID);

            subDiv.children("#SubConditionQuery0").attr("name", "SubConditionQuery" + subID);
            subDiv.children("#SubConditionQuery0").attr("id", "SubConditionQuery" + subID);
            $('#subCondition' + (subID - 1)).after(subDiv[0].outerHTML);
            $('#currentSubid').attr("value", subID);
            document.getElementById(idstr)[subID].selected = true; //选中项
            fireOnchangeEvent(idstr);
            $("#SubConditionValue" + subID).attr("maxlength", 50);
            //相似词检索
            $("#SubConditionValue" + subID).keyup(smartKeyup);
        }
    }

    function fireOnchangeEvent(name) {
        var node = document.getElementById(name)
        if (node.fireEvent) {        //ie
            node.fireEvent('onchange');
        } else if (node.onchange) {
            node.onchange();
        }
    }

    function delCondition() {

        var subID = parseInt($('#currentSubid').val());
        if (subID > 0) {
            $('#subCondition' + subID).remove();
            $('#currentSubid').attr("value", subID - 1);
        }
    }
    //复制原有查询条件
    function copyContion() {

        var select = $('#categoryType').val();
        var checkstr = "";
        if (typeof (myTree) != "undefined") {
            checkstr = myTree.getAllChecked();
        }
        $('#selectedCatTypeID').attr("value", select);
        if (checkstr != "" && checkstr != "0") {
            $('#checkedCatID').val(checkstr);
        }
        else {
            $('#checkedCatID').val("");
        }
        $("#beforecheckedCatID").val($("#checkedCatID").val());
        $("#beforeselectedCatTypeID").val($("#selectedCatTypeID").val());

        $("#beforeConditionValue").val($("#ConditionValue").val());
        $("#beforeConditionKey").val($("#ConditionKey").val());
        $("#beforeQueryValue").val($("#SubConditionQuery").val());

        var subID = parseInt($('#currentSubid').val());//获取当前条件数量
        if (subID > 0) {
            $("#beforeContion").html("");
            for (var i = 1; i <= subID; i++) {
                var beforeType = "beforeConditionType" + i;//新的id
                var conType = $('#' + 'SubConditionType' + i).val();//值
                $("#beforeContion").append("<input id=" + beforeType + " name=" + beforeType + " type=\"text\" value='" + conType + "' />");

                var beforeKey = "beforeConditionKey" + i;//新的id
                var conKey = $('#' + 'SubConditionKey' + i).val();//值
                $("#beforeContion").append("<input id=" + beforeKey + " name=" + beforeKey + " type=\"text\" value='" + conKey + "' />");

                var beforeValue = "beforeConditionValue" + i;//新的id
                var contValue = $('#' + 'SubConditionValue' + i).val();//值
                $("#beforeContion").append("<input id=" + beforeValue + " name=" + beforeValue + " type=\"text\" value='" + contValue + "' />");

                var beforeQuery = "beforeQueryValue" + i;//新的id
                var contQuery = $('#' + 'SubConditionQuery' + i).val();//值
                $("#beforeContion").append("<input id=" + beforeValue + " name=" + beforeQuery + " type=\"text\" value='" + contQuery + "' />");

            }

        }

    }
    $(document).keydown(function (event) {
        if (event.keyCode == 13) {
            search();
        }
    });
    //切换排序方式
    function sortClick(sort, ename) {
        $('#pageIndexNow').val('1');
        $("#sortField").val(ename);
        if (ename == $("#sortFieldBefore").val() || $("#sortFieldBefore").val() == "") { //如果是点击排序字段本身则调整排序顺序
            if (sort == "desc") {
                $('#sortDescAsc').val('asc');
            }
            else {
                $('#sortDescAsc').val('desc');
            }
        }
        else {  //如果是点击其他排序字段，则按数据库默认排序
            var initsort = $("#sortInit").val();
            $('#sortDescAsc').val(initsort);//数据库默认排序
            $("#sortFieldBefore").val(ename);
        }

        searchResult();
    }
    //切换显示模式
    function formatList(formatstr) {
        if (formatstr == "list") {
            //$('#ul_abstract').hide();
            //$('#abstract_a').removeClass('cur');
            //$('#table_list').show();
            //$('#list_a').addClass('cur');
            $('#listOrabst').val('list');
        }
        else {
            //$('#ul_abstract').show();
            //$('#abstract_a').addClass('cur');
            //$('#table_list').hide();
            //$('#list_a').removeClass('cur');
            $('#listOrabst').val('abct');
        }
        searchResult();

    }
    function jumpDoc(id, name, mediaType, displayDBName) {
        window.location.href = "SingleSearch?id=" + id + "&name=" + escape(name) + "&displayDBName=" + escape(displayDBName);
    }

    function jumpMedia(id, name, mediaType, displayDBName) {
        window.location.href = "SingleSearch?id=" + id + "&name=" + escape(name) + "&displayDBName=" + escape(displayDBName);
    }


    function loadMore() {
        $('.talkDiv').removeClass('hidden');
    }
    function hiddenMore() {
        $('.talkDiv').addClass('hidden');
    }

    $(function () {
        fireOnchangeEvent("ConditionKey");
        var subID = parseInt($('#currentSubid').val());
        if (subID > 0) {
            for (var i = 1; i <= subID; i++) {
                fireOnchangeEvent("SubConditionKey" + i);
                $("#SubConditionValue" + i).keyup(smartKeyup);
            }
        }
    })
</script>
@using CNKI.TPI.Web.Base
@using CNKI.TPI.Web.Search.Model
<style type="text/css">
    .wrap-sideL {
        margin-right: -100px;
    }

    .wrap-i-r-s {
        margin-left: -100px;
    }
</style>
<!--内容==开始-->
<div class="wrap">

    <!--面包屑一-->
    <div class="crumbLink">
        @*<a href="javascript:void(0);">当前位置</a>&gt;<a href="javascript:void(0);">文献资源</a>&gt;期刊论文库*@

    </div>

    <div class="clearfix">
        <!-- wrap-sideL==START -->
        @if (ViewBag.CategoryType != null && ViewBag.CategoryType.Count > 0)
            {
            <div class="wrap-sideL">
                <h3 class="wrap-l-t">检索导航</h3>
                <div class="wrap-l-b">

                    <div class="wrap-l-b-h">
                        选择分类导航
                        <select id="categoryType" onchange="categoryChange();" autocomplete="off">
                            @foreach (var item in ViewBag.CategoryType)
                            {
                                if (item.SysID == ViewBag.CategoryCLSID)
                                {
                                    <option value="@item.SysID" selected="selected">@item.Name</option>
                                }
                                else
                                {
                                    <option value="@item.SysID">@item.Name</option>
                                }
                            }
                        </select>
                        @{
                            var ajaxOptions = new AjaxOptions()
                            {
                                HttpMethod = "post",
                                UpdateTargetId = "categroyList",
                                InsertionMode = InsertionMode.Replace
                            };
                            @Ajax.ActionLink("category", "GetCategroyList", new { type = 1 }, ajaxOptions, new { id = "UpdateCatLink", hidden = "hidden", style = "display:none" })
                        }
                    </div>

                    <div class="wrap-l-b-f">
                        <div class="tr">
                            <a onclick="checkAll()">全选</a>&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="unCheckAll()">清除</a>
                        </div>
                        <div class="wrap-l-b-f-con" id="categroyList">
                            @RenderPage("CategoryList.cshtml")
                        </div>
                    </div>

                </div>
            </div>
                            }
        <!-- wrap-sideL==END -->
        @* //当用户登录并且用户不是anony时才展示历史*@
        @if (SessionHelper.GetUserInfo() != null && ConfigHelper.IsShowUserHistoryEnabled()
                && ((ConfigHelper.IsAnonymousControlEnabled() && SessionHelper.GetUserInfo().UserCode.ToUpper() != ConfigHelper.GetAnonymousAccount().ToUpper())
                    || !ConfigHelper.IsAnonymousControlEnabled()))
        {
            <div class="wrap-i-r wrap-i-r-s">
                <!-- wrap-r-tSTART -->
                <div class="wrap-r-box wrap-r-s-box">
                    <h2 class="fwb">检索历史</h2>
                    <div class="posr" id="updatedivH0">

                        @if (ViewBag.DTSearch != null && ViewBag.DTSearch.Rows.Count > 0)
                        { <ul>
                                @foreach (System.Data.DataRow dr in ViewBag.DTSearch.Rows)
                                {
                                    if (string.IsNullOrEmpty(dr["SearchUrL"].ToString()))
                                    {
                                        <li class="li-bg" title="@ColumnAliasHelper.SubContent(dr["Str_Query"].ToString(), 0)">
                                             @Html.Raw(ColumnAliasHelper.SubContent(dr["Str_Query"].ToString(), 18))
                                        </li>
                                    }
                                    else
                                    {
                                        <li class="li-bg">
                                            <a target="_blank" href="@dr["SearchUrL"]" title="@ColumnAliasHelper.SubContent(dr["Str_Query"].ToString(), 0)">
                                                @Html.Raw(ColumnAliasHelper.SubContent(dr["Str_Query"].ToString(), 18))
                                            </a>
                                        </li>
                                    }
                                }
                            </ul>
                            <div class="pos-r-b">
                                <a class="more" target="_blank" href="~/UserCenter/UserCenterIndex?controllstr=UserCenter&actionstr=SearchHistory">更多</a>
                            </div>
                        }
                        else
                        {
                            <label style="font-size:12px;margin-left:20px;">暂无记录</label>
                        }

                    </div>
                </div>
                <div class="wrap-r-box wrap-r-s-box">
                    <h2 class="fwb">浏览历史</h2>
                    <div class="posr" id="updatedivH1">

                        @if (ViewBag.DTView != null && ViewBag.DTView.Rows.Count > 0)
                        {  
                            <ul>
                                @foreach (System.Data.DataRow dr in ViewBag.DTView.Rows)
                                {
                                    <li class="li-bg">
                                        <a target="_blank" href="@dr["DetailUrL"]" title="@ColumnAliasHelper.SubContent(dr["Title"].ToString(), 0)">
                                            @Html.Raw(ColumnAliasHelper.SubContent(dr["Title"].ToString(), 18))
                                        </a>
                                    </li>

                                }
                            </ul>
                            <div class="pos-r-b">
                                <a class="more" target="_blank" href="~/UserCenter/UserCenterIndex?controllstr=UserCenter&actionstr=ViewHistory">更多</a>
                            </div>
                        }
                        else
                        {
                            <label style="font-size:12px;margin-left:20px">暂无记录</label>
                        }

                    </div>
                </div>
                <div class="wrap-r-box wrap-r-s-box">
                    <h2 class="fwb">下载历史</h2>
                    <div class="posr" id="updatedivH2">

                        @if (ViewBag.DTDown != null && ViewBag.DTDown.Rows.Count > 0)
                        {
                            <ul>
                                @foreach (System.Data.DataRow dr in ViewBag.DTDown.Rows)
                                {
                                    <li class="li-bg">
                                        <a target="_blank" href="@dr["DetailUrL"]" title="@ColumnAliasHelper.SubContent(dr["Title"].ToString(), 0)">
                                            @Html.Raw(ColumnAliasHelper.SubContent(dr["Title"].ToString(), 18))
                                        </a>
                                    </li>

                                }
                            </ul>

                                <div class="pos-r-b">
                                    <a class="more" target="_blank" href="~/UserCenter/UserCenterIndex?controllstr=UserCenter&actionstr=DownHistory">更多</a>
                                </div>
                        }
                        else
                        {
                            <label style="font-size:12px;margin-left:20px;">暂无记录</label>
                        }
                    </div>
                </div>
            </div>
        }

        <!-- wrap-sideR==START -->
        @if (ViewBag.CategoryType != null && ViewBag.CategoryType.Count > 0)
        {
            //有分类导航
            if (SessionHelper.GetUserInfo() != null && ConfigHelper.IsShowUserHistoryEnabled()
            && ((ConfigHelper.IsAnonymousControlEnabled() && SessionHelper.GetUserInfo().UserCode.ToUpper() != ConfigHelper.GetAnonymousAccount().ToUpper())
                || !ConfigHelper.IsAnonymousControlEnabled()))
            {
                //显示历史
                @Html.Raw(" <div class='wrap-sideR wrap-sideR-s'>")
            }
            else
            {
                //不显示历史
                @Html.Raw(" <div class='wrap-sideR wrap-sideR-m'>")
            }
        }
        else
        {
            //无分类导航
            if (SessionHelper.GetUserInfo() != null && ConfigHelper.IsShowUserHistoryEnabled()
            && ((ConfigHelper.IsAnonymousControlEnabled() && SessionHelper.GetUserInfo().UserCode.ToUpper() != ConfigHelper.GetAnonymousAccount().ToUpper())
            || !ConfigHelper.IsAnonymousControlEnabled()))
            {
                //显示历史
                @Html.Raw(" <div class=wrap-sideR-l>")
            }
            else
            {
                //不显示历史
                @Html.Raw(" <div class=wrap-sideR-xl>")
            }
        }


        <div class="">
            <!--二级导航==开始-->
            <ul class="nav nav-tabs05 b0 clearfix">
                @if (ViewBag.MediaResource != null && ViewBag.MediaResource.Count > 0)
                {
                    int flage = 0;
                    int i = 0;


                    foreach (CNKI.TPI.Web.Search.Model.SYS_CMS_DATABASE_CLS_NODE item in ViewBag.MediaResource)
                    {

                        if (item.DatabaseList.Count == 0)
                        {
                            continue;
                        }
                        foreach (CNKI.TPI.Web.Search.Model.SYS_CMS_DATABASE item1 in item.DatabaseList)
                        {
                            if (i > 3)
                            {
                                break;
                            }
                            i++;
                            string strclass = "";
                            if (@item1.SysID == @ViewBag.DbID)
                            {
                                flage = 1; @* 当前选中 *@
                    strclass = "class=active";
                }
                <li @strclass><a href="javascript:void(0);" onClick="jumpDoc('@item1.SysID','@item1.DatabaseCode','@item1.TemplateID','@item1.DatabaseName')">@item1.DatabaseName</a></li>
                        }

                    }


                    if (flage == 0)//如果前3个没有当前选中项，就最后一个显示当前选中项
                    {     @* 当前选中 *@

                if (@ViewBag.MediaType != 0 && @ViewBag.MediaType != 1)//多媒体
                {
                    <li class="active"><a href="javascript:void(0);" onClick="jumpMedia('@ViewBag.DbID','@ViewBag.DbName','@ViewBag.MediaType','@ViewBag.DisplayDBName')">@ViewBag.DisplayDBName</a></li>
                }
                else
                {
                    <li class="active"><a href="javascript:void(0);" onClick="jumpDoc('@ViewBag.DbID','@ViewBag.DbName','@ViewBag.MediaType','@ViewBag.DisplayDBName')">@ViewBag.DisplayDBName</a></li>

                    }
                }
                if (i > 3)//超过3个
                {
                    <li class="last"><a href="javascript:void(0)" onclick="loadMore()">更多>></a></li>
                    }
                }
            </ul>
            <!--二级导航==结束-->
            @using (Ajax.BeginForm("Search", new { }, new AjaxOptions()
            {
                HttpMethod = "post",
                InsertionMode = InsertionMode.Replace,
                UpdateTargetId = "docList",
                LoadingElementId = "loading"
            }, new { @class = "form form-h form-h-8em", id = "searchForm" }))
            {
                <fieldset>
                    <div class="f-gp clearfix" id="searchCondition">
                        <span class="f-btn">
                            <a href="javascript:addCondition();" class='iconfont iconfont-add'></a>
                            <a href="javascript:delCondition();" class='iconfont iconfont-minus'></a>
                        </span>

                        @if (ViewBag.SearchLogID != -1)
                        {
                            IList<SearchQuery> searchQuery = ViewBag.SearchQuery;
                            if (searchQuery.Count > 0)
                            {
                                <select id="ConditionKey" name="ConditionKey" class='f-select span2' onchange="fieldChange(this);">
                                    @foreach (var item in ViewBag.SearchField)
                                    {
                                        if (item.FieldName == searchQuery[0].Key)
                                        {
                                            <option value="@item.FieldName" selected="selected">@item.FieldDispName</option>
                                        }
                                        else
                                        {
                                            <option value="@item.FieldName">@item.FieldDispName</option>
                                        }
                                    }
                                </select>
                                    <input style="height: 19px;" id="ConditionValue" name="ConditionValue" type="text" value="@searchQuery[0].Text" class="f-text span4" maxlength="50" />
                                    <select id="SubConditionQuery" name="SubConditionQuery" class='f-select span1'>
                                        @*<option value="0">精确</option>
                                            <option value="2">模糊</option>*@
                                    </select>
                            }
                            else
                            {
                                <select id="ConditionKey" name="ConditionKey" class='f-select span2' onchange="fieldChange(this);">
                                    @foreach (var item in ViewBag.SearchField)
                                    {
                                        <option value="@item.FieldName">@item.FieldDispName</option>
                                    }
                                </select>
                                    <input style="height: 19px;" id="ConditionValue" name="ConditionValue" type="text" value="" class="f-text span4" maxlength="50" />
                                    <select id="SubConditionQuery" name="SubConditionQuery" class='f-select span1'>
                                        @*<option value="0">精确</option>
                                            <option value="2">模糊</option>*@
                                    </select>
                            }
                        }
                        else
                        {
                            <select id="ConditionKey" name="ConditionKey" class='f-select span2' onchange="fieldChange(this);">
                                @foreach (var item in ViewBag.SearchField)
                                {
                                    <option value="@item.FieldName">@item.FieldDispName</option>
                                }
                            </select>
                                <input style="height: 19px;" id="ConditionValue" name="ConditionValue" type="text" value="" class="f-text span4" maxlength="50" />
                                <select id="SubConditionQuery" name="SubConditionQuery" class='f-select span1'>
                                    @*<option value="0">精确</option>
                                        <option value="2">模糊</option>*@
                                </select>
                        }

                        <input class="btn btn-m btn-warn-f btn-submit" type="button" value="检索" onclick="search()" />
                    </div>
                    <input type="hidden" id="beforeQueryValue" name="beforeQueryValue" value="" />
                    <input type="hidden" id="beforeConditionValue" name="beforeConditionValue" value="" />
                    <input type="hidden" id="beforeConditionKey" name="beforeConditionKey" value="" />
                    <input type="hidden" id="beforecheckedCatID" name="beforecheckedCatID" value="" />
                    <input type="hidden" id="beforeselectedCatTypeID" name="beforeselectedCatTypeID" value="" />

                    <div id="beforeContion" style="display: none"></div>
                    @{
                        int currentSubid = 0;
                        if (ViewBag.SearchLogID != -1 && ViewBag.SearchQuery.Count > 1)
                        {
                            currentSubid = ViewBag.SearchQuery.Count - 1;
                        }
                    }
                    <input type="hidden" id="currentSubid" name="currentSubid" value="@currentSubid" />
                    <input type="hidden" id="checkedCatID" name="checkedCatID" value="" />
                    <input type="hidden" id="selectedCatTypeID" name="selectedCatTypeID" value="" />
                    <input type="hidden" id="pageIndexNow" name="pageIndexNow" value="1" />
                    <input type="hidden" id="sortField" name="sortField" value="" />
                    <input type="hidden" id="sortFieldBefore" name="sortFieldBefore" value="@ViewBag.SortFiledInit" />
                    <input type="hidden" id="sortInit" name="sortInit" value="@ViewBag.SortDescInit" />
                    <input type="hidden" id="sortDescAsc" name="sortDescAsc" value="" />
                    <input type="hidden" id="listOrabst" name="listOrabst" value="" />
                    <input type="hidden" id="dbID" name="dbID" value="@ViewBag.dbID" />
                    <input type="hidden" id="dbName" name="dbName" value="@ViewBag.dbName" />
                    <input type="hidden" id="MediaType" name="MediaType" value="@ViewBag.MediaType" />
                    <input type="hidden" id="topicCLSCode" name="topicCLSCode" value="@ViewBag.TopicCLSCode" />
                    <input type="hidden" id="topicCLSNodeCode" name="topicCLSNodeCode" value="@ViewBag.TopicCLSNodeCode" />
                    <input type="hidden" id="AutoLoad" name="AutoLoad" value="@ViewBag.AutoLoad" />
                    <input type="hidden" id="SearchFrom" name="SearchFrom" value="SingleSearch" />
                    <div class="f-gp clearfix" id="subCondition0" style="display: none">
                        <select id="SubConditionType0" name="SubConditionType0" class='f-select span1'>
                            <option value="0">并且</option>
                            <option value="1">或者</option>
                        </select>
                        <select id="SubConditionKey0" name="SubConditionKey0" class='f-select span2' onchange="fieldChange(this);">
                            @foreach (var item in ViewBag.SearchField)
                            {
                                <option value="@item.FieldName">@item.FieldDispName</option>
                            }
                        </select>
                        <input id="SubConditionValue0" name="SubConditionValue0" type="text" value="" class="f-text span4">
                        <select id="SubConditionQuery0" name="SubConditionQuery0" class='f-select span1'>
                            @*<option value="0">精确</option>
                                <option value="2">模糊</option>*@
                        </select>
                    </div>
                    @if (ViewBag.SearchLogID != -1 && ViewBag.SearchQuery.Count > 1)
                    {
                        IList<SearchQuery> searchQuery = ViewBag.SearchQuery;
                        for (int i = 1; i < searchQuery.Count; i++)
                        {
                            string subid = "subCondition" + i;
                            <div class="f-gp clearfix" id="@subid" style="">
                                @Html.Raw("<select id=\"SubConditionType" + i + "\" name=\"SubConditionType" + i + "\" class='f-select span1'>")
                                @Html.Raw("<option value=\"0\" " + (searchQuery[i].Type == SearchMatchType.And ? "selected=\"selected\"" : "") + ">并且</option>")
                                @Html.Raw("<option value=\"1\" " + (searchQuery[i].Type == SearchMatchType.Or ? "selected=\"selected\"" : "") + ">或者</option>")
                                @Html.Raw("</select>")
                                @Html.Raw("<select id=\"SubConditionKey" + i + "\" name=\"SubConditionKey" + i + "\" class='f-select span2' onchange=\"fieldChange(this); \">")
                                @foreach (var item in ViewBag.SearchField)
                                {
                                    if (item.FieldName == searchQuery[i].Key)
                                    {
                                        <option value="@item.FieldName" selected="selected">@item.FieldDispName</option>
                                    }
                                    else
                                    {
                                        <option value="@item.FieldName">@item.FieldDispName</option>
                                    }
                                }
                                @Html.Raw("</select>")
                                @Html.Raw("<input id=\"SubConditionValue" + i + "\" name=\"SubConditionValue" + i + "\" type=\"text\" value=\"" + searchQuery[i].Text + "\" class=\"f-text span4\" maxlength='50'>")
                                @Html.Raw("<select id=\"SubConditionQuery" + i + "\" name=\"SubConditionQuery" + i + "\" class='f-select span1'>")
                                @Html.Raw("</select>")
                            </div>
                        }
                    }
                </fieldset>
                        }
        </div>
        <div id="loading" style="display: none; margin-left: 300px; margin-top: 50px; position: absolute">
            <img src="~/Images/loading.gif" width="50" />
        </div>
        <div id="docList"></div>
        @*隐藏列表暂时直接拼到页面内部*@
        <div class="talkDiv talkW-668 hidden" style="top: 202px; height: 350px; overflow: auto;">
            <div class="talkDiv-title">
                <a class="icon icon-close" title="关闭" onclick="hiddenMore()"><i class="iconfont icon-error3"></i></a>
            </div>
            <div class="talkDiv-body">
                <ul>
                    @if (ViewBag.MediaResource != null && ViewBag.MediaResource.Count > 0)
                    {
                        int i = 0;

                        i = 0;
                        foreach (CNKI.TPI.Web.Search.Model.SYS_CMS_DATABASE_CLS_NODE item in ViewBag.MediaResource)
                        {
                            i++;
                            if (i == ViewBag.MediaResource.Count)
                            {
                                @Html.Raw("<li class=\"talkDivLi last\">")
                            }
                            else
                            {
                                @Html.Raw("<li class=\"talkDivLi\">")
                            }
                            @Html.Raw("<div class=\"talkDivLiT\">" + @item.Name + "</div>")

                            foreach (CNKI.TPI.Web.Search.Model.SYS_CMS_DATABASE item1 in item.DatabaseList)
                            {
                                @Html.Raw("<a href=\"#\" onClick=\"jumpDoc('" + item1.SysID + "','" + item1.DatabaseCode + "','" + item1.DatabaseType + "','" + item1.DatabaseName + "')\"><label class=\"f-label\">" + item1.DatabaseName + "</label></a>")
                            }
                            @Html.Raw("</li>")

                        }


                    }
                </ul>
            </div>
        </div>

        @Html.Raw("</div>")
        <input type="hidden" id="ConditionTypeList" name="ConditionTypeList" value="@ViewBag.ConditionType" />
        <input type="hidden" id="CategoryNodeCode" name="CategoryNodeCode" value="@ViewBag.CategoryNodeCode" />
        <input type="hidden" id="DisplayDBName" name="DisplayDBName" value="@ViewBag.DisplayDBName" />
        
        <!-- wrap-sideR==END -->
    </div>
</div>
<!--内容==结束-->
<script>
    //相似词检索
    $("#ConditionValue").keyup(smartKeyup);
</script>
